/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ecom.dao;

import ecom.entity.Currency;
import org.hibernate.Criteria;
import org.hibernate.criterion.Expression;

/**
 *
 * @author simon
 */
public class CurrencyDAO extends AbstractDAO {
    
    private static final String NAME = "name";
    
    public Currency findByName (String name) {
        Currency cur = null;
        startOperation();
        Criteria crit = session.createCriteria(Currency.class);
        crit.add(Expression.eq(NAME, name));
        cur = (Currency) crit.uniqueResult();
        this.closeSession();
        return cur;
    }
}
